<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<meta name="description" content="">
<meta name="keywords" content="">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<meta name="renderer" content="webkit">
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="stylesheet" type="text/css" href="/Public/css/global.css" />
<link href="/Public/css/style.css" rel="stylesheet" type="text/css" />
<link href="/Public/css/mobiscroll.2.13.2.css" rel="stylesheet" />
<link rel="stylesheet" href="/Public/css/LArea.css">
<script src="/Public/js/jquery-1.10.2.min.js"></script>
<script src="/Public/js/mobiscroll.2.13.2.js"></script>
<script type="text/javascript">
    //表单验证
    function applysubmit() {
        var borrower = document.getElementById("borrower").value;
        var number = document.getElementById("number").value;
        var tel = document.getElementById("tel").value;
        var code = document.getElementById("code").value;
        var cities = document.getElementById("cities").value;
        var id_number = document.getElementById("id_number").value;
        var salary = document.getElementById("salary").value;

        var city2 = document.getElementById("city2");
        var index = city2.selectedIndex;
        var value = city2.options[index].value;

        var city = document.getElementById("city");
        var index = city.selectedIndex;
        var value1 = city.options[index].value;

        var city1 = document.getElementById("city1");
        var index = city1.selectedIndex;
        var value2 = city1.options[index].value;
        var area = document.getElementById("area").value;

        var city0 = document.getElementById("citys");
        var index = city0.selectedIndex;
        var value3 = city0.options[index].value;


        var city3 = document.getElementById("city3");
        var index = city3.selectedIndex;
        var value4 = city3.options[index].value;

        var city4 = document.getElementById("city4");
        var index = city4.selectedIndex;
        var value5 = city4.options[index].value;

        if(borrower=="")
        {
            alert("借款人姓名不能为空！");
            document.getElementById("borrower").focus();
            return false;
        }else if(!(/^[\u4e00-\u9fa5]{2,4}$/.test(borrower)))
        {
            alert("请输入姓名！")
            document.getElementById("borrower").focus();
            return false;
        }else if(number.length<2)
        {
            alert("请输入10以上的数字！");
            document.getElementById("number").focus();
            return false;
        }else if(tel=="")
        {
            alert("手机号不能为空！");
            document.getElementById("tel").focus();
            return false;
        }else if(!(/^1[34578]\d{9}$/.test(tel))) {
            alert("请输入合法的手机号");
            document.getElementById("tel").focus();
            return false;
        }else if(code=="")
        {
            alert("验证码不能为空！");
            document.getElementById("code").focus();
            return false;
        }else if(code.length<6 || code.length>6)
        {
            alert("验证码不正确！");
            document.getElementById("code").focus();
            return false;
        }else if(cities=="")
        {
            alert('所在城市不能为空！');
            document.getElementById("cities").focus();
            return false;
        }else if(id_number=="")
        {
            alert('身份证号不能为空，请输入有效的身份证号！')
            document.getElementById("id_number").focus();
            return false;
        }else if (salary == "")
        {
            alert("工资不能为空！");
            document.getElementById("salary").focus();
            return false;
        } else if (isNaN(salary))
        {
            alert("请输入工资数！");
            document.getElementById("salary").focus();
            return false;
        }else if(value=="")
        {
            alert("请选择申请期限！");

            return false;
        }else if(value1=="")
        {
            alert("请选择公积金！");

            return false;
        }else if(value2=="")
        {
            alert("请选择本地社保！");
            return false;
        }else if (area == "")
        {
            alert("房屋面积不能为空！");
            document.getElementById("area").focus();
            return false;
        } else if (isNaN(area))
        {
            alert("请输入房屋面积！");
            document.getElementById("area").focus();
            return false;
        }else if(value3=="")
        {
            alert("请选择房产类型！");

            return false;
        }else if(value4=="")
        {
            alert("请选择是否有车！");

            return false;
        }else if(value5=="")
        {
            alert("请选择信用情况！");

            return false;
        }

    }
     //选择验证
    function city2Change()
    {
        var city2 = document.getElementById("city2");
        var index = city2.selectedIndex;
        var value = city2.options[index].value;
        if(value=="")
        {
            alert("请选择申请期限！");
            document.getElementById("submit").setAttribute("disabled",true);
            return false;
        }

    }
    function city5Change()
    {
        var city = document.getElementById("city");
        var index = city.selectedIndex;
        var value = city.options[index].value;
        if(value=="")
        {
            alert("请选择公积金！");
            document.getElementById("submit").setAttribute("disabled",true);
            return false;
        }

    }

    function city1Change()
    {
        var city1 = document.getElementById("city1");
        var index = city1.selectedIndex;
        var value = city1.options[index].value;
        if(value=="")
        {
            alert("请选择本地社保！");
            document.getElementById("submit").setAttribute("disabled",true);
            return false;
        }

    }
    function city0Change()
    {
        var city0 = document.getElementById("citys");
        var index = city0.selectedIndex;
        var value = city0.options[index].value;
        if(value=="")
        {
            alert("请选择房产类型！");
            document.getElementById("submit").setAttribute("disabled",true);
            return false;
        }

    }
    function city3Change()
    {
        var city3 = document.getElementById("city3");
        var index = city3.selectedIndex;
        var value = city3.options[index].value;
        if(value=="")
        {
            alert("请选择是否有车！");
            document.getElementById("submit").setAttribute("disabled",true);
            return false;
        }

    }
    function city4Change()
    {
        var city4 = document.getElementById("city4");
        var index = city4.selectedIndex;
        var value = city4.options[index].value;
        if(value=="")
        {
            alert("请选择信用情况！");
            document.getElementById("submit").setAttribute("disabled",true);
            return false;
        }

    }
    //获取验证码
    //单击时执行
    function verify() {
        var tel = document.getElementById("tel").value;
        if(tel=="")
        {
            alert("手机号不能为空！");
            document.getElementById("tel").focus();
            return false;
        }else if(!(/^1[34578]\d{9}$/.test(tel))) {
            alert("请输入合法的手机号");
            document.getElementById("tel").focus();
            return false;
        }
        //验证码倒计时
        var InterValObj; //timer变量，控制时间
        var count = 120; //间隔函数，1秒执行
        var curCount;//当前剩余秒数
        var tel = document.getElementById("tel").value;
        $.ajax({
            url: "/index.php/Home/index/code",
            type: "post",
            data: {'tel': tel},
            datatype: "json",
            success: function (msg) {
                alert(msg);
            },
        });


        curCount = count;
        // 设置button效果，开始计时
        document.getElementById("timespan").setAttribute("onclick", "");//设置按钮为禁用状态
        document.getElementById("timespan").html = "请在" + curCount + "秒后再次获取";//更改按钮文字
        InterValObj = window.setInterval(SetRemainTime, 1000); // 启动计时器
        //timer处理函数

        function SetRemainTime() {
            if (curCount == 0) {
                window.clearInterval(InterValObj);// 停止计时器
                document.getElementById("timespan").setAttribute("onclick","verify()");//移除禁用状态改为可用
                document.getElementById("timespan").text = "重新发送验证码";


            } else {
                curCount--;
                document.getElementById("timespan").text = "请在" + curCount + "秒后再次获取";
            }
        }
    }

    $(function () {
        var curr = new Date().getFullYear();
        var opt = {
            'default': {
                theme: 'default',
                mode: 'scroller',
                display: 'modal',
                animate: 'fade'
            },
				
            'select': {
                preset: 'select'
            },
             
        }

        $('.demo-test-select').scroller($.extend(opt['select'],opt['default']));
        $('.demo-test-selects').scroller($.extend(opt['select'],opt['default']));



       /* //手机号验证
        $("#tel").blur(function() {
            var tel = document.getElementById("tel").value;
            //手机号是否存在
            $.ajax({
                type:"post",
                url:"/index.php/Home/index/check",
                data:{'tel':tel},
                dataType:"json",
                success:function(msg){
                    if(msg==1)
                    {
                        alert("手机号已申请过贷款，请换一个");
                    }
                }
            });
        });*/
        $("#id_number").blur(function() {
            var id_number = document.getElementById("id_number").value;
            $.ajax({
                type:"post",
                url:"/index.php/Home/index/check",
                data:{'id_number':id_number},
                dataType:"json",
                success:function(msg){
                    if(msg==2){
                        $("#submit").attr("disabled",true);
                    }
                }
            });
        });


    });


    </script>   
</head>

  <header id="title">
    <div class="back"><a  href="javascript:void(0)" onclick="javascript:history.go(-1);return false;" ></a>  </div>
    产品申请
  </header>
  <div style="height:40px;"></div>
<form method="post" id="form" action="/index.php/Home/index/applysubmit/id/{$id}/loan_name/{$loan_name}">
  <div class="product_step"><h2>填写借款人资产信息</h2></div>
<ul class="product_sq">
    <li>
        <span>姓名</span>
        <input type="text" class="add-input"  id="borrower" name="borrower" placeholder="请输入借款人姓名">
    </li>
    <li>
        <span>申请借款金额</span>
        <input type="text" class="add-input"  id="number" name="number" placeholder="请输入10以上的数字"><i class="am-text-right">万元</i>
    </li>

    <li>
        <span>手机号</span>
        <input type="text" class="add-input" id="tel" name="tel"  placeholder="请输入手机号">

    </li>
    <li>
        <span>验证码</span>
        <input type="text" class="add-input" style="width:35%;" name="code" id="code" placeholder="请输入验证码">
        <a id="timespan" onclick="verify()" style="padding-top:8Px;background-color:#1A92DE;height:2rem; border-radius: 10px;color: #fff;float: right;">获取验证码</a>
    </li>
    <li>
        <span>所在城市</span>
        <input type="text" class="add-input" id="cities" name="cities"  placeholder="请输入所在城市">
    </li>
    <li>
        <span>身份证号</span>
        <input type="password" class="add-input" name="id_number" id="id_number" placeholder="请输入身份证号">
    </li>
    <li>
        <span>工资</span>
        <input type="text" class="add-input"  name="salary" id="salary" placeholder="请输入工资"><i class="am-text-right">月</i>
    </li>
    <li>
        <span>申请期限</span>
        <div data-role="fieldcontain" class="demo-selects add-input">
            <select id="city2" name="limit" onchange="city2Change()" class="demo-test-select" data-role="none">
            <option value="">请选择</option>
                <option value="1个月">1个月</option>
                <option value="2个月">2个月</option>
                <option value="3个月">3个月</option>
                <option value="4个月">4个月</option>
                <option value="5个月">5个月</option>
              
            </select>
        </div>
        <i class="am-icon-angle-right"></i>
    </li>
    <li>
        <span>公积金</span>
        <div data-role="fieldcontain" class="demo-select add-input">
            <select id="city" name="fund" onchange="city5Change()" class="demo-test-selects" data-role="none">
            <option value="">请选择</option>
                <option value="否，不缴纳">否，不缴纳</option>
                <option value="是，有本地公积金">是，有本地公积金</option>
              
            </select>
        </div>
        <i class="am-icon-angle-right"></i>
    </li>
    <li>
        <span>本地社保</span>
        <div data-role="fieldcontain" class="demo-selects add-input">
            <select id="city1" name="sec" onchange="city1Change()" class="demo-test-selects" data-role="none">
            <option value="">请选择</option>
                <option value="否，没有">否，没有</option>
                <option value="是，有本地社保">是，有本地社保</option>
              
            </select>
        </div>
        <i class="am-icon-angle-right"></i>
    </li>
    <li>
        <span>房产面积</span>
        <input type="text" name="area" class="add-input" id="area" placeholder="请输门房屋面积"><i class="am-text-right">平方米</i>
    </li>
          
    <li>
        <span>房产类型</span>
        <div data-role="fieldcontain" class="demo-selects add-input">
            <select id="citys" name="type" onchange="city0Change()" class="demo-test-selects" data-role="none">
            <option value="">请选择</option>
                <option value="房改/危改房">房改/危改房</option>
                <option value="商铺">商铺</option>
                <option value="厂房">厂房</option>
                <option value="商住两用房">商住两用房</option>
                <option value="办公楼">办公楼</option>
                <option value="军产房">军产房</option>
                <option value="宅基地/自建房">宅基地/自建房</option>
                <option value="有房，但不确认房产类型">有房，但不确认房产类型</option>
            </select>
        </div>
        <i class="am-icon-angle-right"></i>
    </li>
    <li>
        <span>是否有车</span>
        <div data-role="fieldcontain" class="demo-selects add-input">
            <select id="city3" name="car" onchange="city3Change()" class="demo-test-selects" data-role="none">
            <option value="">请选择</option>
                <option value="无车">无车</option>
                <option value="无车，准备购买">无车，准备购买</option>
                <option value="名下有车">名下有车</option>
            </select>
        </div>
        <i class="am-icon-angle-right"></i>
    </li>
    <li>
        <span>信用情况</span>
        <div data-role="fieldcontain" class="demo-selects add-input">
            <select id="city4" name="credit" onchange="city4Change()" class="demo-test-selects" data-role="none">
            <option value="">请选择</option>
                <option value="1年内逾期超过3次或超过90天">1年内逾期超过3次或超过90天</option>
                <option value="1年内逾期超过3次且少于90天">1年内逾期超过3次且少于90天</option>
                <option value="无信用卡或贷款">无信用卡或贷款</option>
                  <option value="信用良好，无逾期">信用良好，无逾期</option>
            </select>
        </div>
        <i class="am-icon-angle-right"></i>
    </li>
</ul>
        <input type="submit" onclick="return applysubmit()" id="submit" class="confirm" value="确认提交"><!--onclick="return applysubmit()"-->
</form>
<script>
var area1 = new LArea();
area1.init({
	'trigger': '#demo1', //触发选择控件的文本框，同时选择完毕后name属性输出到该位置
	'valueTo': '#value1', //选择完毕后id属性输出到该位置
	'keys': {
		id: 'id',
		name: 'name'
	}, //绑定数据源相关字段 id对应valueTo的value属性输出 name对应trigger的value属性输出
	'type': 1, //数据源类型
	'data': LAreaData //数据源
});
area1.value=[1,13,3];//控制初始位置，注意：该方法并不会影响到input的value
var area2 = new LArea();
area2.init({
	'trigger': '#demo2',
	'valueTo': '#value2',
	'keys': {
		id: 'value',
		name: 'text'
	},
	'type': 2,
	'data': [provs_data, citys_data, dists_data]
});
</script>
<script>
	//购物数量加减
	$(function(){
		$('.increase').click(function(){
			var self = $(this);
			var current_num = parseInt(self.siblings('input').val());
			current_num += 1;
			self.siblings('input').val(current_num);
			update_item(self.siblings('input').data('item-id'));
		})		
		$('.decrease').click(function(){
			var self = $(this);
			var current_num = parseInt(self.siblings('input').val());
			if(current_num > 1){
				current_num -= 1;
				self.siblings('input').val(current_num);
				update_item(self.siblings('input').data('item-id'));
			}
		})
	})
</script>
<!-- 弹出层部分-->
<div class="ygydcity_layer">
<div class="ygydcity">
 <div class="ygydcontent">

				<ul class="payment_city_mask">
                    <li class="ygyd_title">返佣比例说明</li>
                    <li class="ygyd_con">您的返佣比例与借款人的借款期限有关，
            详见产品介绍页面说明</li>
					<li class="shiyi_close">知道了</li>
				</ul>
				
</div>								
</div>
<div class="ygydcontent_mark"></div>
</div>				
<script>
$(function(){
	$("#fy_windows").click(function () {
		$('.ygydcity').show(0);
		$('.ygydcontent_mark').show(0);
	});
	$('.shiyi_close').click(function(){
		$('.ygydcity').hide(0);
		$('.ygydcontent_mark').hide(0);
	});
});
</script>
<!-- 弹出层部分-->
<div class="ygydcity_layer">
<div class="ygydcity1">
 <div class="ygydcontent">

				<ul class="payment_city_mask1">
                    <li class="ygyd_title">产权证类型填写说明</li>
                    <li class="ygyd_con"><img src="images/cqimg.jpg" width="100%"></li>
					<li class="shiyi_close">知道了</li>
				</ul>
				
</div>								
</div>
<div class="ygydcontent_mark1"></div>
</div>				
<script>
$(function(){
	$("#cq_windows").click(function () {
		$('.ygydcity1').show(0);
		$('.ygydcontent_mark1').show(0);
	});
	$('.shiyi_close').click(function(){
		$('.ygydcity1').hide(0);
		$('.ygydcontent_mark1').hide(0);
	});
});
</script>
</body>
</html>